//
//  GenseeLivePlugin.swift
//  Runner
//
//  Created by apple on 2020/7/21.
//

import UIKit

class GenseeLivePlugin: NSObject, FlutterPlugin {
    
    //注册插件
    static func register(with registrar: FlutterPluginRegistrar) {
        let channel = FlutterMethodChannel(name: "gensee_live_plugin", binaryMessenger: registrar.messenger())
        let instance = GenseeLivePlugin()
        registrar.addMethodCallDelegate(instance, channel: channel)
    }
    
    //方法调用会传到这里
    func handle(_ call: FlutterMethodCall, result: @escaping FlutterResult) {
        switch call.method {
        case "startLive":
            startLive()
            break
        case "startVod":
            startVod()
            break
        default:
            result(FlutterMethodNotImplemented)
            break
        }
    }
    
    func startLive(){
        print("进入直播")
        
    }
    
    func startVod(){
        print("进入录播")
        
    }
    
    // 顶层 vc
    func topVC() -> UIViewController? {
        
        return UIApplication.shared.keyWindow?.rootViewController
    }
}
